package cn.tedu.micro.demo.device.controller;

import cn.tedu.micro.demo.common.protocol.JsonResult;
import cn.tedu.micro.demo.common.vo.GunInfoVO;
import cn.tedu.micro.demo.device.service.DeviceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class DeviceController {
    @Autowired
    private DeviceService deviceService;
   @GetMapping("/device/gun/info/{gunId}")
    public JsonResult<GunInfoVO> checkGunStatus(@PathVariable(name="gunId") Integer id){
       log.info("检查枪状态:{}",id);
       GunInfoVO vo=deviceService.checkGunStatus(id);
       log.info("返回结果:{}",vo);
       return JsonResult.success(vo);
   }
}
